<!DOCTYPE html>
<html xmlns="http://www.w3c.org/1999/xhtml" 
xmlns:h="http://java.sun.com/jsf/html" 
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:f="http://java.sun.com/jsf/core"
xmlns:fn="http://www.bss.com/functions">

<h:body>
	<h:form id="roomOccForm" prependId="false">
		<h:outputLabel value="Current #{forCurrent}"/>
		<br/>

		<h:commandButton value="Continue Check-in" action="#{roomOccupancyController.continueAdmission}" />		
		
		<ui:repeat var="building" value="#{roomOccupancyController.buildings}" >
			<h3>Building #{building.name}</h3>
			<hr/>
			<ui:repeat var="floor" value="#{arrayCreator[building.floors]}" >
				
				<h4>Floor #{floor}</h4>				
									
					<p:dataGrid value="#{fn:call(roomOccupancyController,'findRooms',fn:concat(fn:concat(fn:concat(fn:concat('building.id=',building.id),',floor='),floor),',dormitory=false'))}" var="room" columns="3">					
						<h:panelGroup rendered="#{ true}">
							<p:selectBooleanCheckbox disabled="#{ empty forCurrent or room.occupied}" value="${room.selected}"/>					
							<h:outputLabel value="#{room.roomNumber}"/>
						</h:panelGroup>
						<h:panelGroup  rendered="#{false}">					
							<h:outputLabel value="#{room.roomNumber}"/>
						</h:panelGroup>												
					</p:dataGrid>				
			</ui:repeat>
		</ui:repeat>
	
		</h:form>
			
	</h:body>
</html>